/*! \file createTiles.cxx
 *      \brief This files has the main function providing the command line
 * interface run the STP reconstruction.
*/
#include <itkImage.h>
#include <iostream>
#include <sstream>
#include <string>
#include "tvMosaicParam.h"

using namespace std;
using namespace itk;

/**********************************************************************
*  arg1 - input File name
*  arg2 - dataset prefix
**********************************************************************/
int main (int argc, char **argv) 
{
  tvMosaicParam *param = new tvMosaicParam();
  for (int i = 0; i < argc; i++) {
    cout << "Argument " << i << "/" << argc-1 << ":" << argv[i] << endl;
  }
  if (argc >= 6) {
      param->SetParamFileName(argv[1]);
      param->SetDataHome(argv[2]);
      param->SetDataProcessingHome(argv[3]);
      param->SetDataPrefix(argv[4]);
      param->SetOutputImageFormat(argv[5]);
      if (argc > 6) {
          param->SetConvertTiles(argv[6]);
          param->SetCalculateCorrectionTile(argv[7]);
          param->SetIlluminationCorrection(argv[8]);
          param->SetStitching(argv[9]);
          param->SetImageResize(argv[10]);
      }
  }
  else {
      cout << "Incorrect number of arguments" << endl;
      cout << "Usage: createTiles <paramFile> <dataHome> <dataProcessingHome> <datasetPrefix> <outputFileFormat>" << endl;
      cout << "Running Example dataset..." << endl;
      param->initializeExampleDataset();
  }
  param->runReconstructionPipeline();

  //param->writeStitchedImageITK(1, 1);
  //param->writePredictedImagesMatlab();
  //param->writeCentroidFilesMatlab();

  return EXIT_SUCCESS;
}
